<div  id="dialog" title="<?php echo $dialogTitle; ?>">
    <?php echo isset($message) ? $message : ''; ?>
</div>
<script type="text/javascript">

<?php if (isset($flag) && $flag == TRUE): ?>
            $(function() {
                $("#dialog").dialog({
                    closeText: "hide",
                    modal: true,
                    close: function() {
                        //window.location.href = '<?php echo base_url('/pit-rules/'.$ParameterId); ?>';
                        $('#hidParameterID').val('<?php echo $ParameterId ?>');       
                        $('#frmCompanyCode').attr('action', '<?php echo base_url();?>pit-rules');  
                        $( "#frmCompanyCode" ).submit();
                    },
                    buttons: [{
                            text: '<?php echo $this->lang->line('MC019'); ?>',
                            click: function() {
                                //window.location.href = '<?php echo base_url('/pit-rules/'.$ParameterId); ?>';
                                $('#hidParameterID').val('<?php echo $ParameterId ?>');       
                                $('#frmCompanyCode').attr('action', '<?php echo base_url();?>pit-rules');  
                                $( "#frmCompanyCode" ).submit();
                                
                            }
                        }],
                });
            });
<?php elseif (isset($flag) && $flag == FALSE): ?>
            $(function() {
                $("#dialog").dialog({
                    buttons: [{
                            text: '<?php echo $this->lang->line('MC019'); ?>',
                            click: function() {
                                $("#dialog").dialog('close');
                            }
                        }]
                });
            });
<?php endif; ?>

</script>

<script>
    $(function() {
        $( ".btn").click(function() {    
                                $('#hidParameterID').val('<?php echo $ParameterId ?>');       
                                $('#frmCompanyCode').attr('action', '<?php echo base_url();?>pit-rules');  
                                $('#frmCompanyCode').submit();          
                                //alert($('#hidParameterID').val());
        });
        //
//        $( ".btn").click(function() {    
//                                $('#hidParameterID').val('<?php echo $ParameterId ?>');       
//                                $('#frmCompanyCode').attr('action', '<?php echo base_url();?>pit-rules');  
//                                $('#frmCompanyCode').submit();          
//                                //alert($('#hidParameterID').val());
//        });
     });
</script>
<!--<form id="frmCompanyCode" action="<?php echo base_url();?>pit-rules" Method="POST">
    <input type="hidden" id="hidParameterID" name="hidParameterID">  
</form>-->

<div id="main_content">
	<h3><?php echo $title; ?></h3>
    <div class="form_add">
	<?php
       echo "<label for='disabledSelect' style='color:red;'>".$this->session->flashdata('message')."</label>";
    ?>    
    <form id="frmCompanyCode" action="" method="post">
       <table border="0" class="add_data">  
                <tr>
                    <td>
                        <a href="javascript:void(0);" rel="<?php echo isset($ParameterId) ? $ParameterId : '' ?>" class="btn addEmoloyeeBack m10"><?php echo $this->lang->line('MC013'); ?></a>
                           
                    </td>  
                    
                </tr>
       		<tr>
            	<td align="right">
                	<label> <?php echo $this->lang->line('pcrr__Level'); ?> </label>
                </td>
                <td>                	
                        <?php 
                            $optionLevel = array(
                                    'name'        => 'txtLevel',                                   
                                    'value'       => isset($Level) ? $Level : '',
                                    'readonly'    =>'readonly',
                                    'style'    =>'background:#D6D6D6;opacity: 0.5;',
                                    'maxlength'   => '2'                                   
                                  );
                             echo form_input($optionLevel)  ; 
                           // echo form_input('txtLevel', isset($Level) ? $Level : '' )  ; 
                            ?>                        
                </td>
                <td>
                    <span class="error"><?php echo form_error('txtLevel'); ?>
                </td>
            </tr>
       		<tr>
            	<td align="right">
                	<label><?php echo $this->lang->line('pcrr__AssociatedAmount'); ?> </label>
                </td>
                <td>                	
                        <?php 
                            $optionAssociatedAmount = array(
                                    'name'        => 'txtAssociatedAmount', 
                                    'id'          => 'txtAssociatedAmount', 
                                    'value'       => isset($AssociatedAmount) ? $AssociatedAmount : '',
                                    'maxlength'   => '10'                                   
                                  );
                            echo form_input($optionAssociatedAmount)  ; ?> &nbsp; VNĐ
                </td>                
                <td>
                    <span class="error"><?php echo form_error('txtAssociatedAmount'); ?>
                </td>
            </tr>
       		<tr>
            	<td align="right">
                	<label><?php echo $this->lang->line('pcrr__Rate'); ?></label>
                </td>
                <td>					
                                        <?php 
                                      
                                        if(isset($Rate)){ 
                                            if(check_float_string($Rate) && $Rate!=0){
                                                $Rate=$Rate*100;
                                            }else{                                        
                                                $Rate=$Rate;
                                            }
                                        }else{  
                                            $Rate="";
                                        }
                                            $optionRate = array(
                                                'name'        => 'txtRate',                                   
                                                'value'       => $Rate,
                                                'maxlength'   => '5'
                                              );
                                            echo form_input($optionRate)  ; 
                                            ?> &nbsp; %
                </td>
                <td>
                    <span class="error"><?php echo form_error('txtRate'); ?>
                </td>
            </tr>
            <?php  if(isset($Del_Flag)){                                                             ?>
            <tr>
                <td align="right"><?php echo $this->lang->line('spl__Delete');?></td>
                <td><input type="checkbox" <?php echo ($Del_Flag==1) ? 'checked' : ''?> name="chkDelete" /></td>
            </tr>
            <?php } ?>
       		<tr>         
                <td colspan="2" align="left">
                        <input type="hidden" id="hidParameterID" name="hidParameterID" value="<?php echo isset($PITCalculationRuleId) ? $ParameterId.'-'.$PITCalculationRuleId : $ParameterId; ?>">
                	<input type="hidden" value="true" name="btnButton"/>
                        <input id="btnSubmit" name="btnSubmit" type="submit" value="<?php echo $this->lang->line('MC008'); ?>">
                        <input style="display:none;" type="reset" name="reset" value="Cancel">
                </td>
            </tr>                                                                                          
       </table> 
    </form>
    </div>
</div>

<script>
    $(function(){
         
            // Set up the number formatting.
            //$('#txtShowAssociatedAmount').on('keypress',function(){
              //  $('#txtAssociatedAmount').number( true,2 );
              //  return false;
            //});
          
            
            // Get the value of the number for the demo.
            //$('#txtAssociatedAmount').on('change focus keypress',function(){
            //var val = $('#txtShowAssociatedAmount').val();            
            //$('#number_container').slideDown('fast');
            //$('#txtAssociatedAmount').val(val !== '' ? val : '(empty)');
           // });

        }); 


</script>
<!--Number : <input type="text" name="quantity" id="quantity" />&nbsp;<span id="errmsg"></span>-->

<script>
$(document).ready(function () {
  //called when key is pressed in textbox
  $("#quantity").keypress(function (e) {
     //if the letter is not digit then display error and don't type anything
     if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
        //display error message
        $("#errmsg").html("Digits Only").show().fadeOut("slow");
               return false;
    }
   });
});
</script>



